package com.shi.yoyoshop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shi.yoyoshop.bean.Type;
import com.shi.yoyoshop.mapper.TypeMapper;
import com.shi.yoyoshop.service.TypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 20556
 * @description 针对表【type】的数据库操作Service实现
 * @createDate 2024-01-04 16:07:19
 */
@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type>
        implements TypeService {

    @Resource
    private TypeMapper typeMapper;

    @Override
    public Type getOneByTypeId(Integer typeId) {
        return typeMapper.selectOne(new LambdaQueryWrapper<Type>()
                .select(Type::getId, Type::getName, Type::getStatus)
                .eq(Type::getStatus, 1)
                .eq(Type::getId, typeId));
    }

    @Override
    public List<Type> getTypeList() {
        return typeMapper.selectList(new LambdaQueryWrapper<Type>().eq(Type::getStatus, 1));
    }
}




